<?php

namespace app\third\controller;

use think\facade\Db;

class Test extends \app\BaseController
{
    public function getSign()
    {
        $data = input('post.');
        if (empty($data['app_key'])) {
            return fail('app_key 不能为空');
        }
        $data['timestamp'] = time();
        $appSecret = Db::name('agent')
            ->where('app_key', $data['app_key'])
            ->value('app_secret');
        if (empty($appSecret)) {
            return fail('账号不存在或者被禁用');
        }
        $data['sign'] = getSign($data, $appSecret);
        return json($data);
    } 

    public function notify()
    {
        echo 'SUCCESS';
        // echo file_get_contents('php://input');
    }
}